package com.knowif.backend.service;

import com.github.pagehelper.PageHelper;
import com.knowif.pojo.Special;
import com.knowif.pojo.SpecialExample;
import com.knowif.service.Special_service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Xh
 * 专业Service
 * @date ：Created in 2019/6/5 0005 20:58
 */
@Service
public class SpecialService {

    @Autowired
    private Special_service special_service;

    /**
     * 条件查询special
     * @param specialExample
     * @return
     */
    public List<Special> selectSpecial(SpecialExample specialExample){
        return special_service.selectSpecial(specialExample);
    }

    /**
     * 条件查询special
     * @param specialExample
     * @param pageable 是否需要分页
     * @return
     */
    public List<Special> selectSpecial(SpecialExample specialExample, boolean pageable){
        if(! pageable){
            PageHelper.clearPage();
        }
        return special_service.selectSpecial(specialExample);
    }


    /**
     * 保存special
     * @return
     */
    public boolean saveSpecial(Special special){
        int i = special_service.saveSpecial(special);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 保存special
     * @return
     */
    public boolean updateSpecialNotNull(Special special){
        int i = special_service.updateSpecialNotNull(special);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 保存special
     * @return
     */
    public boolean updateSpecial(Special special){
        int i = special_service.updateSpecial(special);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 删除special
     * @return
     */
    public boolean deleteSpecial(int specialId){
        int i = special_service.deleteSpecial(specialId);
        if(i == 0){
            return false;
        }
        return true;
    }

}
